<template>
    <div>
        {{num}}
    </div>
</template>

<script>
export default {
  props: {
    from: {
      type: Number
    }
  },
  data () {
    return {
      num: this.from
    }
  },
  mounted () {
    this.t = setInterval(() => {
      this.num--
      if (this.num <= 0)clearInterval(this.t)
    }, 1000)
  },
  destroyed () {
    clearInterval(this.t)
  }
}
</script>

<style>

</style>
